home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************************************
- *
- *
- * MacZoop - "the framework for the rest of us"
- *
- *
- *
- * ZPrefsFile.cpp -- the prefs file object
- *
- *
- *
- *
- *
- * © 1996, Graham Cox
- *
- *
- *
- *
- *************************************************************************************************/
-
-
- #include "ZPrefsFile.h"
- #include "MacZoop.h"
-
- #include <folders.h>
-
- static FSSpec gDummySpec = { 0, 0, "\p" };
-
-
- ZPrefsFile::ZPrefsFile( Str255 fName )
- : ZResourceFile( gDummySpec )
- {
- short foundVR;
- long dirID;
- OSErr theErr;
-
- itsType = kPrefsFileType;
-
- FailOSErr( FindFolder( kOnSystemDisk, kPreferencesFolderType, TRUE, &foundVR, &dirID ));
-
- theErr = FSMakeFSSpec( foundVR, dirID, fName, &itsSpec );
-
- if ( theErr == fnfErr )
- CreateResFork();
- else
- FailOSErr( theErr );
- }
-
-
-
- ZPrefsFile::ZPrefsFile()
- : ZResourceFile( gDummySpec )
- {
- short foundVR;
- long dirID;
- OSErr theErr;
-
- itsType = kPrefsFileType;
-
- FailOSErr( FindFolder( kOnSystemDisk, kPreferencesFolderType, TRUE, &foundVR, &dirID ));
-
- // make the filename by using the app's name and appending "prefs" (STR#128/16)
-
- Str255 fName;
- Str31 pf;
-
- gApplication->GetName( fName );
- GetIndString( pf, 128, 16 );
- ConcatPStrings( fName, pf );
-
- theErr = FSMakeFSSpec( foundVR, dirID, fName, &itsSpec );
-
- if ( theErr == fnfErr )
- CreateResFork();
- else
- FailOSErr( theErr );
- }